package com.hdu.hot100.doublePointer;

public class lc283 {
    class Solution {
        public void moveZeroes(int[] nums) {
            int noZeroIndex = 0;
            for (int i = 0; i < nums.length; i++) {
                if (nums[i] != 0) {
                    swap(nums, i, noZeroIndex);
                    noZeroIndex++;
                }
            }
        }

        void swap(int[] nums, int i, int j)
        {
            int tmp = nums[i];
            nums[i] = nums[j];
            nums[j] = tmp;
        }
    }
}
